how to do new lines? [ textarea -> jquery -> p tag ]
Posted
by Haroldo
on Stack Overflow
See other posts from Stack Overflow
or by Haroldo
Published on 2010-04-10T12:37:35Z
Indexed on
2010/04/10
12:43 UTC
Read the original article
Hit count: 212
jQuery
|JavaScript
I'm doing something very similar to the stackoverflow question preview only much more basic.
user types in text area -> keyup shows what they've typed in preview
new lines aren't working
$('input, textarea').keyup(function(){
var value = $this.attr('value').replace('\n', '<br />').replace('\r', '<br />');
$('p.preview').html(value);
})
© Stack Overflow or respective owner